home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
dskut
/
mmv10.zip
/
MMV.1
< prev
next >
Wrap
Text File
|
1989-11-22
|
18KB
|
658 lines
.\" Under BSD, just give to nroff or troff (with -man).
.\" To print the MS-DOS version, use option -rO2.
.\" Under System V, take out the '.\" ' from the next line.
.\" .nr O 1
.TH MMV 1 "November 20, 1989 (v1.0)"
.ie !'\nO'2' \{\
.SH NAME
mmv \- move/copy/append/link multiple files by wildcard patterns
\}
.el \{
.SH NAME
mmv \- move/copy/append multiple files by wildcard patterns
\}
.ie '\nO'2' \{\
.ds SL \\\\
.ds ES '
\}
.el \{\
.ds SL /
.ds ES \\\\
\}
.SH SYNOPSIS
.B mmv
.if '\nO'2' [\fB-m\fP|\fBx\fP|\fBr\fP|\fBc\fP|\fBo\fP|\fBa\fP|\fBz\fP]
.if '\nO'0' [\fB-m\fP|\fBx\fP|\fBr\fP|\fBc\fP|\fBo\fP|\fBa\fP|\fBl\fP|\fBs\fP]
.if '\nO'1' [\fB-m\fP|\fBx\fP|\fBr\fP|\fBc\fP|\fBo\fP|\fBa\fP|\fBl\fP]
[\fB-h\fP]
[\fB-d\fP|\fBp\fP]
[\fB-g\fP|\fBt\fP]
[\fB-v\fP|\fBn\fP]
[\fBfrom to\fP]
.if '\nO'2' \{\
.br
.B mmvpatch
[\fBexecutable\fP]
\}
.SH "DESCRIPTION"
.I Mmv
moves (or copies,
.ie '\nO'2' or appends,
.el appends, or links,
as specified)
each source file matching a
.I from
pattern to the target name specified by the
.I to
pattern.
This multiple action is performed safely,
i.e. without any unexpected deletion of files
due to collisions of target names with existing filenames
or with other target names.
Furthermore, before doing anything,
.I mmv
attempts to detect any errors that would result
from the entire set of actions specified
and gives the user the choice of either
proceeding by avoiding the offending parts
or aborting.
.ce
The Task Options
.PP
Whether
.I mmv
moves, copies,
.ie '\nO'2' or appends
.el appends, or links
is governed by the first set of options given
above.
If none of these are specified,
.ie '\nO'2' \{\
a default (patchable by
.IR mmvpatch ,
and initially -x)
determines the task.
\}
.el \{\
the task is given by the command name under which
.I mmv
was invoked (argv[0]):
command name default task
mmv -x
.br
mcp -c
.br
mad -a
.br
mln -l
\}
.PP
The task option choices are:
.TP
-m :
move source file to target name.
Both must be on the same device.
Will not move directories.
.if '\nO'0' \{\
If the source file is a symbolic link,
moves the link without checking if the link's target from the new
directory is different than the old.
\}
.TP
-x :
same as -m, except cross-device moves are done
by copying, then deleting source.
When copying, sets the
.ie !'\nO'2' permission bits
.el attributes
and file modification time
of the target file to that of the source file.
.TP
-r :
rename source file or directory to target name.
The target name must not include a path:
the file remains in the same directory in all cases.
This option is the only way of renaming directories under
.IR mmv .
.if '\nO'2' It is only available under DOS version 3.0 or higher.
.TP
-c :
copy source file to target name.
Sets the file modification time and
.ie !'\nO'2' permission bits
.el attributes
of the target file to that of the source file,
regardless of whether the target file already exists.
Chains and cycles (to be explained below) are not allowed.
.TP
-o :
overwrite target name with source file.
.ie '\nO'2' \{\
If target file exists, its attributes are left unchanged.
If not, it is created with ordinary attributes
unrelated to the source file's attributes.
In either case, the file modification time is set to the current time.
\}
.el \{\
If target file exists, it is overwritten,
keeping its original owner and permission bits.
If it does not exist, it is created, with read-write permission bits
set according to
.IR umask (1),
and the execute permission bits copied from the source file.
In either case, the file modification time is set to the current time.
\}
.TP
-a :
append contents of source file to target name.
Target file modification time is set to the current time.
If target file does not exist,
it is created with
.ie '\nO'2' attributes
.el permission bits
set as under -o.
Unlike all other options, -a allows multiple source files to have the
same target name, e.g. "mmv -a
.ie '\nO'2' *.c
.el \\*.c
big" will append all ".c" files to "big".
Chains and cycles are also allowed, so "mmv -a f f" will double up "f".
.ie '\nO'2' \{\
.TP
-z :
same as -a, but if the target file exists, and its last character is a ^Z,
and the source file is not empty,
this ^Z is truncated before doing the append.
\}
.el \{\
.TP
-l :
link target name to source file.
Both must be on the same device,
and the source must not be a directory.
Chains and cycles are not allowed.
.if '\nO'0' \{\
.TP
-s :
same as -l, but use symbolic links instead of hard links.
For the resulting link to aim back at the source,
either the source name must begin with a '/',
or the target must reside in either the current or the source directory.
If none of these conditions are met, the link is refused.
However, source and target can reside on different devices,
and the source can be a directory.
\}
\}
.PP
Only one of these option may be given,
and it applies to all matching files.
Remaining options need not be given separately,
i.e. "mmv -mk" is allowed.
.ce
Multiple Pattern Pairs
.PP
Multiple
.I from
--
.I to
pattern pairs may be specified by omitting
the pattern pair on the command line,
and entering them on the standard input,
one pair per line.
(If a pattern pair is given on the command line,
the standard input is not read.)
Thus,
.in +3
mmv
.br
a b
.br
c d
.in -3
would rename "a" to "b" and "c" to "d".
If a file can be matched to several of the given
.I from
patterns,
the
.I to
pattern of the first matching pair is used.
Thus,
.in +3
mmv
.br
a b
.br
a c
.in -3
would give the error message "a -> c : no match" because file "a"
(even if it exists)
was already matched by the first pattern pair.
.ce
The \fIFrom\fP Pattern
.PP
The
.I from
pattern is a filename
with embedded wildcards: '*', '?', '['...']',
.if '\nO'2' \{\
\'!',
\}
and ';'.
The first three have their usual
.IR sh (1)
meanings of, respectively,
matching any string of characters,
matching any single character,
and matching any one of a set of characters.
.PP
Between the '[' and ']', a range from character 'a' through character 'z'
is specified with "a-z".
The set of matching characters can be negated by inserting
a '^' after the '['.
Thus, "[^b-e2-5_]"
will match any character but 'b' through 'e', '2' through '5', and '_'.
.if '\nO'2' \{\
.PP
Unlike DOS wildcards,
all mmv wildcards (except for cases listed below)
can occur anywhere in the pattern,
whether preceding or following explicit characters or other wildcards.
For example, the pattern "*z\\foo.bar" will search
for files named "foo.bar" in all subdirectories whose names end in 'z'.
However, no wildcards can occur in the drive letter.
.PP
The character '.' is not matched by any of '*', '?', or '['...']'.
Thus, the pattern "*" will only match files with a null extension.
To save yourself some typing, use the '!' wildcard instead,
which matches the same as "*.*",
except it is assigned only one wildcard index (see below).
Thus, both "f!" and "f*.*"
will match all of "f", "f.ext", "foo", and "foo.ext",
while "f*" will match only the first and the third.
\}
.PP
Note that paths are allowed in the patterns,
and wildcards may be intermingled with slashes arbitrarily.
The ';' wildcard
is useful for matching files at any depth in the directory tree.
It matches the same as "*\*(SL" repeated any number of times, including zero,
and can only occur either at the beginning of the pattern
or following a '\*(SL'.
Thus ";*.c" will match all ".c" files in or below the current directory,
while "\*(SL;*.c" will match them anywhere on the file system.
.if !'\nO'2' \{\
.PP
In addition, if the
.I from
pattern
(or the
.I to
pattern)
begins with "~/", the '~' is replaced with the home directory name.
(Note that the "~user" feature of
.IR csh (1)
is not implemented.)
However, the '~' is not treated as a wildcard,
in the sense that it is not assigned a wildcard index (see below).
\}
.PP
Since matching a